namespace TDUnit.Common.TestData
{
    public class PrimaryKeyColumn : Column
    {
        #region Constructors
        public PrimaryKeyColumn(string name)
            : base(name)
        {
        }
        #endregion

        #region Public properties
        public bool IsAutoIdentity { get; private set; }
        #endregion

        #region Public methods
        public PrimaryKeyColumn WithIsAutoIdentity(bool isAutoIdentity)
        {
            IsAutoIdentity = isAutoIdentity;
            return this;
        }
        #endregion

        #region Overrides
        public override bool Equals(object obj)
        {
            var equal = base.Equals(obj);
            var pk = obj as PrimaryKeyColumn;
            return (equal && pk != null && pk.IsAutoIdentity == IsAutoIdentity);
        }

        public override int GetHashCode()
        {
            return (base.GetHashCode().ToString() + IsAutoIdentity).GetHashCode();
        }
        #endregion
    }
}